package com.itheima.a01polymorphismdemo01;

public class Test {
    public static void main(String[] args) {
        //创建对象
        Student s = new Student();
        s.setName("张三");
        s.setAge(18);

        Teacher t = new Teacher();
        t.setName("李四");
        t.setAge(20);

        Admin a = new Admin();
        a.setName("王吴");
        a.setAge(50);

        register(s);
        register(t);
        register(a);
    }

    //实现登录功能  把参数写成父类
    public static void register(Person p) {
        p.show();
    }
}
